// hyb_yl/czhuanjiasubpages/pages/alladept/alladept.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    questiontabs: 0,
    shanchanglist: ["全部(550)", "气胸(16)", "肺癌(18)", "胸腔积液(5)", "肋骨骨折(4)", "心包积液(2)", "多汗症(1)"],
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var zid = options.zid;
    this.setData({
      zid:zid
    })
    this.getList();
  },
  getList:function(){
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/zhuanjia.getdocinfo',
      data: {
        zid: that.data.zid,
        openid: wx.getStorageSync('openid')
      },
      success: function (res) {
        console.log(res)
        wx.setNavigationBarTitle({
          title: res.data.z_name
        })
        var biaoqian = res.data.authority[0].bq
        console.log(biaoqian)
        app.util.request({
          'url': 'entry/wxapp/zhuanjia.getgkquestionall',
          data: {
            zid: that.data.zid,
            biaoqian: biaoqian
          },
          success: function (res) {
            console.log(res)
            that.setData({
              listqs: res.data
            })
          }
        })
        that.setData({
          authority: res.data.authority
        })

      }
    })
  },
  questionclick(e) {
    var that = this
    var biaoqian = e.currentTarget.dataset.biaoqian
    var zid = that.data.zid
    app.util.request({
      'url': 'entry/wxapp/zhuanjia.getgkquestionall',
      data: {
        zid: zid,
        biaoqian: biaoqian
      },
      success: function (res) {
        console.log(res)
        that.setData({
          listqs: res.data
        })
      }
    })
    this.setData({
      questiontabs: e.currentTarget.dataset.dex
    })
  },
  answer_detail:function(e){
    var id = e.currentTarget.dataset.id;
    var title = e.currentTarget.dataset.title;
    var typs = e.currentTarget.dataset.typs;
    var state = e.currentTarget.dataset.state
    wx.navigateTo({
      url: '/hyb_yl/twosubpages/pages/publicProblemsInfor/publicProblemsInfor?id=' + id + '&title=' + title + '&typs=' + typs + '&state=' + state,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})